<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="/form" id="form" method="post" enctype="multipart/form-data">
    <input type="text" name="name">
    <input type="password" name="password">
    <input type="file" name="file">
    <input type="submit">
</form>
</body>
<script>
    const form = document.getElementById('form')
    form.addEventListener('submit', e => {
        e.preventDefault()
        const formData = new FormData(form)
        fetch('/form', {
            method: 'POST',
            body: formData
        })
    })
</script>
</html>